KeyGenerator kg = KeyGenerator.getInstance("DESede");
            kg.init(168);
            SecretKey k = kg.generateKey();
            byte[] ptext2 = k.getEncoded();
            Socket socket = new Socket("127.0.0.1", 4421);
            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
            BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
            //RSA算法，使用服务器端的公钥对DES的密钥进行加密
            FileInputStream f3 = new FileInputStream("Skey_RSA_pub.dat");
            ObjectInputStream b2 = new ObjectInputStream(f3);
            RSAPublicKey pbk = (RSAPublicKey) b2.readObject();
            BigInteger e = pbk.getPublicExponent();
            BigInteger n = pbk.getModulus();
            BigInteger m = new BigInteger(ptext2);
            BigInteger c = m.modPow(e, n);
            String cs = c.toString();
            out.println(cs); // 通过网络将加密后的秘钥传送到服务器
            System.out.print("请输入待发送的数据：");
            //用DES加密明文得到密文
            String s = stdin.readLine(); // 从键盘读入待发送的数据
            String postfix = MyBC.toPostfix(s);
            Cipher cp = Cipher.getInstance("DESede");
            cp.init(Cipher.ENCRYPT_MODE, k);
            byte ptext[] = postfix.getBytes("UTF8");
            byte ctext[] = cp.doFinal(ptext);
            String str = parseByte2HexStr(ctext);
            out.println(str); // 通过网络将密文传送到服务器



String line = in.readLine();
            BigInteger cipher = new BigInteger(line);
            FileInputStream f = new FileInputStream("Skey_RSA_priv.dat");
            ObjectInputStream b = new ObjectInputStream(f);
            RSAPrivateKey prk = (RSAPrivateKey) b.readObject();
            BigInteger d = prk.getPrivateExponent();
            BigInteger n = prk.getModulus();//mod n
            BigInteger m = cipher.modPow(d, n);//m=d (mod n)
            System.out.println("d= " + d);
            System.out.println("n= " + n);
            System.out.println("m= " + m);
            byte[] keykb = m.toByteArray();
            // 使用DES对密文进行解密
            String readline = in.readLine();//读取客户端传送来的数据
            FileInputStream f2 = new FileInputStream("keykb1.dat");
            int num2 = f2.available();
            byte[] ctext = parseHexStr2Byte(readline);
            Key k = new SecretKeySpec(keykb,"DESede");
            Cipher cp = Cipher.getInstance("DESede");
            cp.init(Cipher.DECRYPT_MODE, k);
            byte[] ptext = cp.doFinal(ctext);
            String p = new String(ptext, "UTF8");//编码转换
            System.out.println("从客户端接收到信息为：" + p); //打印解密结果
            NewMyDC evaluator = new NewMyDC();
            int _result = evaluator.value(p);
            out.println("Echo:" + _result);
            out.close();
            in.close();
            link.close();
